<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<head>
	<title>岗位设置</title>
    <%@ include file="/WEB-INF/jsp/public/common.jspf" %>
</head>
<body> 
<script type="text/javascript">
	function a() {

		var id = document.getElementsByName("id")[0].value;

		var roleName = document.getElementsByName("roleName");
		var name = document.getElementsByName("name")[0].value;
		var text = document.getElementById("ro");
		if (name.indexOf(" ") >= 0) {
			alert("角色名不能有空格");
			return false;
		}
		if (name.length < 1) {
			alert("角色名不能为空");
			return false;
		}
		for (var i = 0; i < roleName.length; i++) {
			if (roleName[i].value == name) {
				alert("角色名已存在！");
				document.getElementsByName("name")[0].style.color = "red";
				text.style.color = "red";
				return false;
			}
		}
		if (id.length < 1) {
			document.form.action = "role_add.action";
			document.form.submit();
			document.getElementById('container').style.display = "none";
			document.getElementById('hide1').style.display = "";
			return true;
		} else {
			document.form.action = "role_edit.action";
			document.form.submit();
			document.getElementById('container').style.display = "none";
			document.getElementById('hide1').style.display = "";
			return true;
		}

	}
</script>
<!-- 标题显示 -->
<div id="Title_bar">
    <div id="Title_bar_Head">
        <div id="Title_Head"></div>
        <div id="Title"><!--页面标题-->
            <img border="0" width="13" height="13" src="${pageContext.request.contextPath}/style/images/title_arrow.gif"/> 岗位设置
        </div>
        <div id="Title_End"></div>
    </div>
</div>

<!--显示表单内容-->
<div id="MainArea">

    <s:form action="" name="form" target="right">
    	<s:hidden name="id"></s:hidden>
    
        <div class="ItemBlock_Title1"><!-- 信息说明<DIV CLASS="ItemBlock_Title1">
        	<IMG BORDER="0" WIDTH="4" HEIGHT="7" SRC="${pageContext.request.contextPath}/style/blue/images/item_point.gif" /> 岗位信息 </DIV>  -->
        </div>
        
        <!-- 表单内容显示 -->
        <div class="ItemBlockBorder">
            <div class="ItemBlock">
                <table cellpadding="0" cellspacing="0" class="mainForm">
                    <tr>
                        <td width="100"><div id="ro">岗位名称</div></td>
                        <td><s:textfield name="name" cssClass="InputStyle" /> *</td>
                    </tr>
                    <tr>
                        <td>岗位说明</td>
                        <td><s:textarea name="description" cssClass="TextareaStyle"></s:textarea></td>
                    </tr>
                </table>
            </div>
        </div>
        		<s:iterator value="#roleNames" status="st">
			<s:hidden name="roleName" value="%{#roleNames.get(#st.index)}"
				cssClass="InputStyle" />
		</s:iterator>
        <!-- 表单操作 -->
        <div id="InputDetailBar">
            <img src="${pageContext.request.contextPath}/style/images/save.png" onclick="a();"/>
            <a href="javascript:history.go(-1);"><img src="${pageContext.request.contextPath}/style/images/goBack.png"/></a>
        </div>
    </s:form>
</div>

</body>
</html>

